<%@page import="java.util.List"%>
<%@page import="br.com.digidata.negocio.*"%>
<%@page import="br.com.digidata.modelo.*"%>
<%
	PacienteDAO pacienteDao = new PacienteDAO();
	List<Paciente> pacientes = pacienteDao.retrive(); 

    AgendaDAO dao = new AgendaDAO();
    Agenda a = dao.getById(Integer.parseInt(request.getParameter("id")));    
%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<form method="POST" name="novoAgenda" action="agendaEditDestino.jsp" id="agendaEdit">
    <label for="paciente_id">Paciente:</label>
    <select id="paciente_id" name="paciente_id" class="select ui-widget-content ui-corner-all">
    	<% for(Paciente p : pacientes) { %>
    	<option value="<%=p.getId()%>" <%=(p.getId() == a.getPaciente().getId()) ? "selected" : ""%>><%=p.getNome() %></option>
    	<% } %>
    </select>
    <label for="data">Data:</label>
    <input type="text" id="data" name="data" value="<%=a.getData()%>" class="text ui-widget-content ui-corner-all"/>
    <label for="hora">Hora:</label>
    <input type="text" id="hora" name="hora" value="<%=a.getHora()%>" class="text ui-widget-content ui-corner-all"/>
    <input type="hidden" name="id" value="<%=a.getId()%>"/>
    <input type="hidden" name="medico_id" value="<%=a.getMedico().getId()%>"/>
</form>
